#include <iostream>
#include <set>
#include <queue>
using namespace std;

typedef long long LL;
set<LL> u;
priority_queue<LL, vector<LL>, greater<LL> >pq;

int main() {
    ios_base::sync_with_stdio(false);cin.tie(nullptr);
    pq.push(1); u.insert(1);
    for (int i = 1; i <= 1499; ++i) {
        LL x = pq.top(); pq.pop();
        LL times[]={2, 3, 5};
        for(const auto &i:times){
            if(!u.count(i*x)){
                u.insert(i*x);
                pq.push(i*x);
            }
        }
    }
    LL x = pq.top();
    cout << "The 1500'th ugly number is " << x << ".\n";
    return 0;

}